import request from "@/api/index";
import user from "@/store/User/user";
/**
 * 根据jobName去查jobs
 */
export const getJobs = (jobName,page,size)=>{

return request.get(`/job/jobs?jobName=${jobName}&page=${page}&size=${size}`)

}
/**
 * 
 * @returns 下拉菜单的职位
 */
export const getJobNames = ()=>{

    return request.get(`/job/getJobNames`)
}
/**
 * 申请过的职位
 * @param {} userId 
 * @returns 
 */
export const getApplyJobs = (userId)=>{

    return request.get(`/apply/getAppliedJobs?userId=${userId}`)
    
}



export const postApplyJob = (userId, jobId, nowtime) => {
    const data = {
        userId,
        jobId,
        nowtime
    };

    return request.post('/apply/applyJob', data);
}


export const getInterestedEnterprises = (userId)=>{

    return request.get(`/interest/getInterestedEnterprises?userId=${userId}`)
    
}


export const interestEnterprise = (userId, enterpriseId,nowtime) => {
    const data = {
        userId,
        enterpriseId,
        nowtime
    };

    return request.post('/interest/addInterest', data);
}


export const getMyApplyJobs = (jobName,userId,page,size)=>{

    return request.get(`/job/getMyJobs?jobName=${jobName}&userId=${userId}&page=${page}&size=${size}`)
    
}

export const getJobsByEnterpriseId2 = (enterpriseId)=>{

    return request.get(`/job/getJobsByEnterpriseId?enterpriseId=${enterpriseId}`)
    
}


export const getEnterpriseInfo2 = (id)=>{

    return request.get(`/enterprise/getEnterpriseInfo?id=${id}`)
    
}